#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time  : 2019/8/11 21:25
# @Author: Eason
# @File  : forms.py
# @Desc  :

from django import forms


class CheckImageForm(forms.Form):
    """
    校验图形验证码
    """

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request')
        super().__init__(*args, **kwargs)

    moblie = forms.CharField(
        max_length=11,
        min_length=11,
        error_messages={
            'max_length': '手机长度有误',
            'min_length': '手机长度有误',
            'required': '手机号码不能为空',
        }
    )  # 变量名要与前端传回来的名称对应

    captcha = forms.CharField(
        max_length=4,
        min_length=4,
        error_messages={
            'max_length': '验证码长度有误',
            'min_length': '验证码长度有误',
            'required': '验证码不能为空',
        }
    )  # 变量名要与前端传回来的名称对应